﻿using System.ServiceModel;
using System.ServiceModel.Web;
using CoreLibrary.Paging;
using CoreLibrary.Service;
using Entities.DataBase.Obj;
using WebService.Service.Transfer;

namespace WebService.Service {

    [ServiceContract]
    public interface IOrderServiceX {

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat    = WebMessageFormat.Json,
            ResponseFormat   = WebMessageFormat.Json,
            UriTemplate = "/CreateOrder")]
        bool CreateOrder(string passport, CreateOrderRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/CancelOrder")]
        bool CancelOrder(string passport, int orderId);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat    = WebMessageFormat.Json,
            ResponseFormat   = WebMessageFormat.Json,
            UriTemplate = "/UpdateOrder")]
        bool UpdateOrder(string passport, UpdateOrderRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/UpdateOrderStatus")]
        bool UpdateOrderStatus(string passport, int orderId, int status);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/TrackOrder")]
        string TrackOrder(string passport, int orderId);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/ListOrders")]
        PagingResult<OrderInfo> ListOrders(string passport, PagingRequest request);

        [OperationContract]
        [FaultContract(typeof(ServiceError))]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/SearchOrders")]
        PagingResult<OrderInfo> SearchOrders(string passport, SearchOrderRequest request);

    }
}
